package com.stwitinc.redmine.res.thread;

import java.util.Timer;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

import com.stwitinc.redmine.RedmineCommonUtil;
import com.stwitinc.redmine.dao.issue.IssueDAOImpl;


public class ThreadRes extends HttpServlet
{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public void init() throws ServletException {

	}

	class MyTask extends java.util.TimerTask {
		public void run() {
			System.out.println("检查任务过重线程启动。。。");
			
		   new IssueDAOImpl().informForTooManyTasks();
		}
	}

	public void init(ServletContext context) throws Exception {
		
		System.out.println("检查任务过重线程启动。。。");
		
		Timer timer = new Timer();
		timer.schedule(new MyTask(), 0, RedmineCommonUtil.informForTooManyTasks_Thread_Interval);
	}

}
